<?php

namespace app\serverexchangerate\service\Exchangerate;
use app\manage\service\ApiBase;

/**
 * @author:      李颖
 * @DateTime:    2017-09-11 17:00:58
 * @Description: 汇率
 */

class Exchangerate extends ApiBase
{
	
	protected $exchangerateLogic = 'app\serverexchangerate\logic\Exchangerate';
    protected $exchangerateValidate = 'app\serverexchangerate\validate\Exchangerate';

    use \app\serveruser\traits\AddUserIdToRunOne;

    /*添加一条汇率记录 注；若只传一个价格，则所有价格相同(仅适用于添加功能！)*/
    public function addRate(): array 
    {
    	$data = $this->haveIssetReceiveData(['max_price'=>0, 'min_price'=>0, 'open_price'=>0, 'close_price'=>0, 'now_price'=>0, 'token'=>' ']);
        return $this->_addUserIdToRunOne('manage_id', $data, 'serverexchangerate/exchangerate/Exchangerate/addRate', '', '1', $this->exchangerateValidate, $this->exchangerateLogic, true, false);
    }

    /*获取汇率记录列表（分页数据）*/
    public function rateList(): array 
    {
    	$data = $this->haveIssetReceiveData(['page'=>1,'listRows'=>15, 'token'=>' ']);
    	return $this->oneStepRun($data, 'serverexchangerate/exchangerate/Exchangerate/rateList', '', '1', $this->exchangerateValidate, $this->exchangerateLogic);
    }

    /*修改其中一条记录*/
    public function updateRate(): array 
    {
    	$data = $this->issetReceiveData(['id'=>0, 'max_price'=>0, 'min_price'=>0, 'open_price'=>0, 'close_price'=>0, 'now_price'=>0, 'token'=>' ']);
    	return $this->_addUserIdToRunOne('manage_id', $data, 'serverexchangerate/exchangerate/Exchangerate/updateRate', '', '1', $this->exchangerateValidate, $this->exchangerateLogic, true, false);
    }

    /*删除一条汇率记录*/
    public function delOneRate(): array 
    {
    	$data = $this->haveIssetReceiveData(['id'=>0, 'token'=>' ']);
    	return $this->oneStepRun($data, 'serverexchangerate/exchangerate/Exchangerate/delOneRate', '', '1', $this->exchangerateValidate, $this->exchangerateLogic);
    }

    

}




